<extend name="Base/common" />
<block name="body">
		<header class="ui-header ui-header-stable ui-border-b">
		    <i class="ui-icon-return returnOrder"></i>
		    <h1>申请退货</h1>
		    <button class="ui-btn returnhelp">退货帮助</button>
		</header>
		
		<section class="ui-container">
			
			<!--s return-process-->
			<div class="ui-return-process ui-whitespace">
				<h4 class="ui-process-title ui-border-b">退货流程</h4>
				<div class="ui-step">
					<div class="ui-step-bar"></div>
					<ul class="ui-step-list">
						<li <eq name="data.return_status" value="2">class="selected"</eq>><small>申请退货</small></li>
						<li <eq name="data.return_status" value="3">class="selected"</eq>><small>审核通过</small></li>
						<li <if condition="($data['return_status'] eq 5) OR ( $data['return_status'] eq 6 ) ">class="selected"</if>><small>寄回退货商品</small></li>
						<li <if condition="$data['return_status'] eq 8 ">class="selected"</if>><small>退款完成</small></li>
					</ul>
				</div>
				<if condition="($data['return_status'] eq 6) OR ($data['return_status'] eq 8)">
					<h4 class="ui-process-title">请注意查收银行退款的信息</h4>
					<div class="ui-process-info">
						<p><b class="ui-txt-info">·</b>&nbsp;&nbsp;<small>退回：</small></p>
						<p><b class="ui-txt-info">·</b>&nbsp;&nbsp;<small>收款人姓名：{$row.open_name}</small></p>
						<p><b class="ui-txt-info">·</b>&nbsp;&nbsp;<small>账号：{$row.bank_account}</small></p>
						<p><b class="ui-txt-info">·</b>&nbsp;&nbsp;<small>收款人开户行：{$row.open_bank_name}</small></p>
						<!-- <p><b class="ui-txt-info">·</b>&nbsp;&nbsp;<small>包裹应含：送货单（若无送货单，请将订单号写在白纸上）及退货商品</small></p> -->
					</div>
				<else />
					<h4 class="ui-process-title">请等待退货审核</h4>
					<div class="ui-process-info">
						<p><b class="ui-txt-info">·</b>&nbsp;&nbsp;<small>厂家将<font color="red">1小时</font>内完成审核；</small></p>
						<p><b class="ui-txt-info">·</b>&nbsp;&nbsp;<small>审核通过后，请在商品签收之后的<font color="red">7天内</font>按退货地址寄出包裹</small></p>
						<p><b class="ui-txt-info">·</b>&nbsp;&nbsp;<small>包裹应含：送货单（若无送货单，请将订单号写在白纸上）及退货商品</small></p>
					</div>
				</if>
				
				<div class="ui-undo-btn-wrap ui-flex ui-flex-pack-end">
					<input type="hidden" id="order" value="{$data.order}">
					<input type="hidden" id="return_order" value="{$data.order_id}">
					<if condition="$data['return_status'] lt 5">
						<a href="javascript::" class="ui-undo-btn cancel_return">撤销退货申请</a>
					</if>
					<if condition="($data.return_status eq 3) ">
					<a href="{:U('return_wuliu', array('return_order_id' => $data['return_order_id']))}" class="ui-undo-btn ui-undo-btn-red">填写退货物流</a>
					</if>
				</div>
			</div>
			<!--e return-process-->
			
			<!--s return-address-->
			<div class="ui-return-address ui-whitespace">
				<h4 class="ui-process-title ui-border-b ">退货地址</h4>
				<div class="ui-return-address-form">
					<div class="ui-form-item ui-form-item-show ui-border-b">
			            <label for="#">收货人</label>
			            <input type="text" value="{$data.name}" readonly>
			        </div>
			        <div class="ui-form-item ui-form-item-textarea ui-border-b">
			            <label class="ui-txt-info">退货地址</label>
			            <textarea readonly>{$data.address}</textarea>
			        </div>
			        <div class="ui-form-item ui-form-item-show ui-border-b">
			            <label for="#">邮编</label>
			            <input type="text" value="{$data.code}" readonly>
			        </div>
			        <div class="ui-form-item ui-form-item-show ui-border-b">
			            <label for="#">联系电话</label>
			            <input type="text" value="{$data.phone}" readonly>
			        </div>
				</div>
			</div>
			<!--e return-address-->
		</section>
</block>
<block name="script">
	<script type="text/javascript">
		$('.cancel_return').tap(function(){
			var dia=$.dialog({
		        title:'温馨提示',
		        content:'撤销此订单后，将不能再申请退货？',
		        button:["确认","取消"]
		    });
		    dia.on("dialog:action",function(e){
		    	if(e.index == 0){
					$.ajax({
						url: "{:U('ReturnGoods/user_cancel')}",
						type: 'POST',
						data: {
							order: $('#order').val(),
							return_order: $('#return_order').val()
						},
						dataType: 'json',
						error: function(){
							$.tips({content:'连接服务器失败！',stayTime:2000,type:"success"});
						},
						beforeSend:function(){
							el = $.loading({content:'加载中...'})
						},
						success: function(r){
							el.loading("hide");
							if(r.status){
								$.tips({content:r.info,stayTime:2000,type:"success"});
								window.location.href = r.url;
							}else{
								$.tips({content:r.info,stayTime:2000,type:"success"});
							}
						}
					});
				}
		    });
		});

		var len = $('.ui-step ul .selected').index();
		$('.ui-step div').addClass('step-bar-' + (len + 1));
		for (var i = 0; i < len; i ++) {
			$('.ui-step ul li').eq(i).addClass('selected');
		};

		//返回订单
		$('.returnOrder').tap(function(){
			window.location.href = "{:U('Order/index', array('type' => 0))}";
		});

		//退货帮助
		$('.returnhelp').tap(function(){
			window.location.href = "{:U('GoodsList/goods_info', array('type' => 1))}";
		});
	</script>
</block>